package com.ajmd.onlineexam.enumeration;

/**
 * @author ajmd
 * @since 2023/3/8 21:40
 * 业务异常枚举
 */
public enum AppExceptionCodeEnum {
    ACCOUNT_NOT_EMPTY(1001,"账号不能为空"),
    ACCOUNT_NOT_EXISTS(1002,"账号不存在"),
    ACCOUNT_EXISTS(1003,"账号已存在"),
    PASSWORD_NOT_EMPTY(1004,"密码不能为空"),
    PASSWORD_ERROR(1005,"密码错误"),

    PASSWORD_TOO_SHORT(1106,"密码不能过短"),
    ACCOUNT_OR_PASSWORD_NOT_EMPTY(1107,"账号或密码不能为空"),
    PASSWORD_DISACCORD(1108,"两次输入的密码不一致"),
    PARAM_ERROR(1109, "参数不正确"),
    FILE_UPLOAD_ERROR(1110, "文件上传错误"),
    IMG_UPLOAD_ERROR(1111,"图片上传错误"),
    IMG_DELETE_ERROR(1112,"图片删除失败"),

    EXCEL_DATA_IMPORT_ERROR(1201, "Excel数据导入错误"),
    INSERT_ERR(1202,"数据插入失败"),
    UPDATE_ERR(1203,"数据修改失败"),
    DELETE_ERR(1204,"数据删除失败"),
    SELECT_ERR(1205,"数据查询失败"),

    FOLDER_ADD_ERR(1305,"分类新增失败"),
    FOLDER_DELETE_ERR(1306,"分类删除失败，该分类下已关联数据"),
    FOLDER_ADD_MAX_ERR(1307,"分类新增失败，已达到最大层级数"),
    FOLDER_NOT_EXISTS(1308,"分类不存在"),
    EXIST_CHILDREN_FOLDER_PUBLIC(1309,"分类下存在公开的分类，无法将此分类改为私有"),
    EXIST_QUESTION_BANK_PUBLIC(1310,"分类下存在公开的题库，无法将此分类改为私有"),

    NOT_AUTHORITY(1400,"没有该权限"),
    STUDENT_NOT_AUTHORITY(1401,"学生没有该权限"),
    TEACHER_NOT_AUTHORITY(1402,"教师没有该权限"),

    INSERT_QUESTION_BANK_ERR(1500,"新建题库失败"),
    DELETE_QUESTION_BANK_ERR(1501,"题库删除失败"),
    UPDATE_QUESTION_BANK_ERR(1502,"题库编辑失败"),
    MOVE_QUESTION_BANK_ERR(1503,"题库移动失败"),
    QUESTION_BANK_NOT_EXISTS(1504,"题库不存在"),
    NOT_QUESTION_BANK_CREATE_PERSON(1505,"非题库创建人，无权管理试题"),

    INSERT_QUESTION_ERR(1600,"新建试题失败"),
    DELETE_QUESTION_ERR(1601,"试题删除失败"),
    UPDATE_QUESTION_ERR(1602,"试题编辑失败"),
    UPDATE_QUESTION_DIFFICULTY_ERR(1603,"试题难度修改失败"),
    QUESTION_NOT_EXISTS(1604,"试题不存在"),

    INSERT_TEST_PAPER_ERR(1700,"新建试卷失败"),
    DELETE_TEST_PAPER_ERR(1701,"试卷删除失败"),
    UPDATE_TEST_PAPER_ERR(1702,"试卷编辑失败"),
    MOVE_TEST_PAPER_ERR(1703,"试卷移动失败"),
    TEST_PAPER_NOT_EXISTS(1704,"试卷不存在"),
    NOT_TEST_PAPER_CREATE_PERSON(1705,"非试卷创建人，无权管理试卷"),

    TEST_PAPER_QUESTION_SAVE_ERROR(1800,"试卷试题保存失败"),

    EXAM_PUBLISH_ERR(1900,"考试发布失败"),
    EXAM_NOT_EXIST(1901,"考试不存在"),
    EXAM_DELETE_ERR(1902,"考试删除失败"),
    EXAM_CLOSE_ERR(1903,"考试关闭失败"),


    NOT_THE_SUBJECT_OF_EXAM(2000,"非考试对象，无法获取考试试题"),
    EXAM_NOT_STARTED(2001,"考试未开始"),
    REACH_MAX_LIMIT_TIMES(2002,"考试次数已用尽");


    private final Integer code;
    private final String message;

    AppExceptionCodeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "ResultCodeEnum{" + "code=" + code + ", message='" + message + '\'' + '}';
    }
}
